# -*- coding: utf-8 -*-
# @Author : Yuan
from django.urls import path
from apps.meiduo_admin.views.login_admin import meiduo_obtain_jwt_token
from apps.meiduo_admin.views.home import *
from apps.meiduo_admin.views.user import *
from apps.meiduo_admin.views.images import *
from apps.meiduo_admin.views.sku import SKUModelViewSet, GoodsCategoryListAPIView
from apps.meiduo_admin.views import sku
from apps.meiduo_admin.views import permission
from apps.meiduo_admin.views import order
from apps.meiduo_admin.views import spu
from apps.meiduo_admin.views import specification
from apps.meiduo_admin.views import specoption
from apps.meiduo_admin.views import brand
from apps.meiduo_admin.views import channels
from rest_framework.routers import DefaultRouter

urlpatterns = [
    # path(r'authorizations/', obtain_jwt_token),
    path(r'authorizations/', meiduo_obtain_jwt_token),
    path(r'statistical/day_active/', UserDailyActiveCountView.as_view()),
    path(r'statistical/day_orders/', UserDailyOrderCountView.as_view()),
    path(r'statistical/total_count/', UserTotalCountView.as_view()),
    path(r'statistical/day_increment/', UserDailyIncrementCountView.as_view()),
    path(r'statistical/month_increment/', UserMonthIncrementCountView.as_view()),
    path(r'statistical/goods_day_views/', GoodsDailyViews.as_view()),
    path(r'users/', UserListView.as_view()),
    path(r'skus/simple/', SKUView.as_view()),
    path(r'skus/categories/', GoodsCategoryListAPIView.as_view()),
    path(r'goods/simple/', sku.SPUListView.as_view()),
    path(r'goods/<spu_id>/specs/', sku.SPUSpecificationListAPIView.as_view()),
    path(r'permission/content_types/', permission.ContentTypesListAPIView.as_view()),
    path(r'permission/simple/', permission.PermissionListAPIView.as_view()),
    path(r'permission/groups/simple/', permission.GroupListAPIView.as_view()),
    path(r'orders/', order.OrderInfoListAPIView.as_view()),
    path(r'orders/<order_id>/', order.OrderGoodsListAPIView.as_view()),
    path(r'orders/<order_id>/status/', order.OrderInfoUpdateAPIView.as_view()),
    # path(r'goods/brands/simple/', spu.BrandListAPIView.as_view()),
    path(r'goods/channel/categories/', spu.GoodsCategoryListAPIView.as_view()),
    path(r'goods/channel/categories/<parent_id>/', spu.GoodsCategoryListAPIView.as_view()),
    path(r'goods/specs/simple/', specoption.SPUSpecificationModelListView.as_view()),
    path(r'goods/channel_types/', channels.GoodsChannelGroupListAPIView.as_view()),
    path(r'goods/categories/', channels.GoodsCategoryListAPIView.as_view()),
]


# 创建router实例
router = DefaultRouter()
# 注册路由
router.register(r'skus/images', ImageView, basename='images')
router.register(r'skus', SKUModelViewSet, basename='skus')
router.register(r'permission/perms', permission.PermissionModelViewSet, basename='perms')
router.register(r'permission/groups', permission.GroupModelViewSet, basename='groups')
router.register(r'permission/admins', permission.AdminUserModelViewSet, basename='admins')
router.register(r'goods/specs', specification.SPUSpecificationModelViewSet, basename='specs')
router.register(r'goods/brands', brand.BrandModelViewSet, basename='brands')
router.register(r'goods/channels', channels.GoodsChannelModelViewSet, basename='channels')
router.register(r'goods', spu.SPUModelViewSet, basename='goods')
router.register(r'specs/options', specoption.SpecificationOptionModelViewSet, basename='options')
# 添加到urlpatterns
urlpatterns += router.urls
